package cn.gson.work.model.service;

import cn.gson.work.model.mapper.ProfisMapper;
import cn.gson.work.model.pojos.Profit;
import cn.gson.work.model.pojos.Profitcat;
import cn.gson.work.model.pojos.Project;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProfitsService {
    @Autowired
    ProfisMapper profiMapper;
    public List<Profit> Pt(){
        return profiMapper.Pt();
    }
    public List<Project> xm(){
        return profiMapper.xm();
    }
    public List<Profitcat> cate(){
        return profiMapper.cate();
    }

    //根据前端传到后台对象里面 ID值是否为空或0进行新增或者修改
    public void addf(Profit profit){
        if(profit.getPfId()!=0){
            profiMapper.xg(profit);
        }else {
            profiMapper.addf(profit);
        }
    }
}
